<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require ("DbConnector.php");
/**
 * Description of ForumDAO
 *
 * @author Administrator
 */
class ForumDAO {
    //put your code here
    var $conn;
    function __construct() {

        $db = new DbConnector();
        $this->conn = $db->getConnection();

    }


    public function getForumInfo($id){


        $dbname = 'messageboardot_db';
        mysql_select_db($dbname) or die ("Could not select database");

        $sql_statement = "SELECT ID ,THREAD_NAME ,CREATION_DATE , LAST_POST_DATE FROM THREADS WHERE FORUM_ID = " . $id;
        $result = mysql_query($sql_statement);



        $forums;
        $count = 0;

        while($row = mysql_fetch_array($result)) {
            $forum['ID'] = $row['ID'];
            $forum['THREAD_NAME'] = $row['THREAD_NAME'];
            $forum['CREATION_DATE'] = $row['CREATION_DATE'];
            $forum['LAST_POST_DATE'] = $row['LAST_POST_DATE'];
            $forums[$count] = $forum;
            $count++;
        }

        return $forums;

    }

}
?>
